Meep unit transformation Wiki
This wiki should help to understand the transformation of physical quantities calculated by Meep to other unit systems. The Meep unit system Because Meep is mainly used in photonics, the majority of its users does not need the quantities calculated by Meep expressed in a standard units system like the International System of Units (SI). Hence, the output quantities of Meep are given dimensionless. However, users working in other fields of electrodynamics might be interested in transforming these quantities to different unit systems. This issue shall be addressed here. Maxwell's equations in meep are formulated the same way as in the SI system. Hence, the SI base units are the starting point: All physical quantities can be expressed using seven basic quantities, which are also called the "dimensions" of a quantity. (For instance the velocity has the dimensions length/time). In Electrodynamics, only four of these basic quantities are relevant: length l, time t, current I, and mass m corresponding to the SI base units meter, seconds, Amperes, and kilogram, respectively. But, since the choice of the base units (not dimensions) is arbitrary, one can also choose different "units" to the measure the basic physical quantities, for example a characteristic length scale of the observed system. This is done in meep: The physical quantities in meep are given dimensionsless, per definition. So one can calculate the solution to Maxwell's equations for the length 1 and rescale the solution afterwards with his/her choice of a unit length. Given all the units of the basic quantities, one can easily calculate the transformation factors of any other quantity. The basic quantities Length: First, let's start up with the length scale. This can be chosen arbitrarily, so lets call it 'a'. 'a' stands for any unit scale of your choice. So it could be meters if you want to use the SI system but also yards if you would prefore that. So we define: l:=a (1) meaning that we measure length in units of a (a distance of the length a in your units has the distance 1 in meep units). Time: For t we go a slightly different way. Here we define the time unit such that the vacuum velocity of light c=1 and c being the velocity unit. To obtain this, we take a look at the dimensions of c. Since c is a velocity they are l/t. So we choose t:=\frac{a}{c} (2) leading to v=\frac{l}{t}=\frac{ac}{a}=c . ''Example: ''If you observe a electromagnetic wave in meep propagating with the vacuum speed of light, its velocity in meep units v_m=1 . So if you want know the velocity in your own units v_o you have to rescale it by performing v_o=v_m c . (But naturally you have to express c in your own units!) For instance, in SI units you will observe: v_o=299792458 \frac{m}{s} * 1 . See example 1 below, where the same fact is shown by employing Meep. Current and Mass: As we have chosen c=1 in meep units and we do know that c^2=\frac{1}{\mu_0\epsilon_0} from Maxwell's equations, we find \mu_0 \epsilon_0=1 . The most convenient way to fulfill this condition is to set \epsilon_0:=1 \rightarrow \mu_0=1 . This definition can be used to derive the units of another quantity or alternatively a relation of two quantity. Here, we aim for the latter and use the dimensions of permittivity \frac{t^4 I^2}{ m l^3} . With that and the previous assumption ( \epsilon_0=1 in meep units) we find: \frac{I^2}{m}=\frac{\epsilon_0 c^4}{a} , (3) Obviously, (3) only relates I and m and so we can define another basic unit arbitrarily. Here we define I:=I_0 . (4) Instead of I you could use also m, or another quantity like for instance power. (For the latter you would have to express I oder m in (3) and in terms of power). To see the implications in meep, please take a look at Example 2 below. With (4) we directly get: m=\frac{I_0^2 a}{\epsilon_0 c^4} . (5) Note: Since there are four basic quantities, there also four degrees of freedoms which allow us to make four basic assumptions. The way above is one possible combination of those assumptions (l=a, c=1, \epsilon_0=1, I=I_0). Transformation On the basis of the findings from above, one can easily compute the transformation of quantities in Meep units to his/her unit system of choice. The general way to do this is the following: #Observe the unit of the quantity of interest expressed in basic quantities of the SI System (length, time, current, mass). ( \frac{l}{t} for a velocity v ) #Replace the basic quantities by their units derived in the previous section to obtain the transformation factor. ( \frac{l}{t} \rightarrow \frac{a*c}{a}=c for v ) #Calculate the numerical value of the transformation factor by expressing all quantities in your unit system. ( c=299792458 \frac{m}{s} ) #Multiply the quantity of interest with the transformation factor to obtain the quantity in your unit system. ( v' =v*c=v*299792458 \frac{m}{s} ) Transformation for the most relevant quantities The table below shows the most important quantities in Meep, their dimensions, the transformation factor and the numerical value of the transformation factor. Each transformation factor was derived using the assumption made above. The corresponding numerical values were calculated for the SI system using the following values: a=1 \, m I =1 \, A c=2.99792458*10^8 \frac{m}{s} \epsilon_0=8.854187817*10^{-12} \frac{F}{m} 1: Note that this is a Meep specific formulation of electric conductivity that introduced an factor \epsilon_r Example 1: Observing the value of c using Meep While dealing with numerical models, examples are instructive. Hence, we want to determine the vacuum velocity of light by employing meep. Thus, we observe a continuous wave emitted from a continuous wave source with the frequency f=5 . This corresponds to the following scheme script: (define L 2) ;total size of the volume (define f 5) ;frequency of the continuous source (define-param srctype Ex) (set! dimensions 1) (set! resolution 1000) (set! Courant 0.5) (set! geometry-lattice (make lattice (size no-size no-size L))) (set! geometry (list (make block (center 0 0 0) (size L 0 0)) )) (set! sources (list (make source (src (make continuous-src (frequency f))) (component srctype) (center 0 0 0) (size 0 0 0)) )) (set! pml-layers (list (make pml (thickness 0.1)))) (use-output-directory "output") (run-until 100 (at-time 100 output-efield-x) ) (output-real-field-function "z" '() (lambda ® (vector3-z r))) Running the script with Meep and plotting E_x from the file 'ex-000200000.h5' we find the result depicted in Figure 1. Obviously, the wavelength \lambda=0.2 . Thus we get: v=f*\lambda=1 q.e.d. Example 2: The relation of the fields and the current density in one dimension Obviously, there is no general closed form relation of the electric field and any source current in an arbitrarily designed domain (otherwise the demand of numerical solvers would be less). But for a homogeneous one dimensional domain with \epsilon_r=1, \, \mu_r=1, \, \sigma_D=0, \, \sigma_M=0 , and J(x,t):=j(t)\delta(x) one can derive the relation: E_x(x,t) = - \frac{1}{2c\epsilon_0} j(t-|x|) (6) which leads to E_x(x,t) = - \frac{1}{2} j(t-|x|) (7) in Meep units. To proof that (7) is true for Meep we employ a Gaussian shaped source current line density j(t)=\exp({-\frac{(t-5)^2}{2}}) . The corresponding implementation in Meep is given in this scheme script: (define L 22) ;total size of the volume (define w 1) ;frequency (define-param srctype Ex) ;direction of the source current (set! dimensions 1) (set! resolution 20) (set! Courant 0.5) (set! geometry-lattice (make lattice (size no-size no-size L))) ;the domain has one dimension (set! geometry (list (make block (center 0 0 0) (size 0 0 L) (material (make dielectric (epsilon 1)))) )) (set! sources (list (make source ;define a gaussian shaped (in time) current density at z=0 (src (make custom-src (src-func (lambda (t) (exp (- (/ (sqr (- t 5)) 2))))))) (component srctype) (center 0 0 0) (size 0 0 0)) )) (set! pml-layers (list (make pml (thickness 1)))) (use-output-directory "ehexample") (run-until 10 (at-time 10 output-efield-x) ) The resulting electric field compared to the source current line density is shown in Figure 2 for t=10 . We directly see that (7) is valid for this case. But we can also proof the unit transformation: From the table above we get the transformation factor \frac{I_0}{a\epsilon_0 c} for the electrical field. To derive the electric field in SI units we have to multiply (7) by this factor: E' = \frac{I_0}{a\epsilon_0 c}*E = -\frac{I_0}{2a\epsilon_0 c} j . Using the assumptions I_0 = 1 A and a = 1 m we get E' = -\frac{1}{2\epsilon_0 c} j in accordance with (6). q.e.d. Note: Using current sources in Meep requires some attention to really represent the wished case: A current source is represented by the current I=\int_\Omega J d\Omega' , while \Omega is the domain specified by (size dx dy dz) around (center x y z) in (set! sources ...). But the interpretation of the integral expression is handled like the integration by (integrate-field-function ...): If the domain has no extend in one direction (e.g. dy=0), Meep assumes that J is described by a delta distribution around the center coordinate in this direction (e.g. \delta(y'-y) ). I.e. a point source! In the example above we defined a point dipol source by setting (size 0 0 0) with the given current density (this was validated by the comparison to (7)). But setting (size 0 0 0.05) i.e. a source that is extended over one grid cell, we get a resulting electric field that which is similar than the one observed before but multiplicated by the extend of the domain in this direction. That means that now the current source corresponds to a point dipol with the current 0.05*J . Category:Science Category:Maxwell's Equations Category:Meep